fix(init): warn when jq is missing during hook installation#864
Open
blpsoares wants to merge 1 commit intortk-ai:developfrom
Open
fix(init): warn when jq is missing during hook installation#864blpsoares wants to merge 1 commit intortk-ai:developfrom
blpsoares wants to merge 1 commit intortk-ai:developfrom
Conversation
b363c2d to
4bea219
Compare
Contributor
|
Hey We are cleaning up the codebase and improving the project structure for better onboarding. As part of this effort, PR #826 reorganizes No logic changes — only file moves and import path updates. What you need to doRebase your branch on git fetch origin && git rebase origin/developGit detects renames automatically. If you get import conflicts, update the paths: use crate::git; // now: use crate::cmds::git::git;
use crate::tracking; // now: use crate::core::tracking;
use crate::config; // now: use crate::core::config;
use crate::init; // now: use crate::hooks::init;
use crate::gain; // now: use crate::analytics::gain;Need help rebasing? Tag @aeppling |
The shell-based hook (rtk-rewrite.sh) requires jq to parse JSON from Claude Code / Cursor. When jq is not installed the hook exits silently (exit 0, no output), causing every command to fall through without RTK rewriting — resulting in zero token savings with no visible error. Add a soft check during `rtk init -g` that warns the user if jq is not found on PATH, with install instructions for common platforms. This is a stopgap until the hook is replaced by a native Rust subcommand (see rtk-ai#785). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4bea219 to
ce418d9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rtk init -g(and Cursor hook installation) that warns whenjqis not found on PATHProblem
The shell-based hook (
rtk-rewrite.sh) requiresjqto parse the JSON payload from Claude Code. Whenjqis not installed, the hook exits silently (exit 0, no output), causing every command to fall through without RTK rewriting — resulting in zero token savings with no visible error.This is particularly frustrating because
rtk init -greports success,rtk gainshows the hook is "configured", but nothing actually works. The user can spend hours in a Claude Code session with no savings and no indication of what's wrong.Approach
This is intentionally a minimal, non-breaking fix:
This is a stopgap until #785 lands, which eliminates the
jqdependency entirely by replacing the shell hook with a nativertk hook claudesubcommand.Test plan
rtk init -gwith jq installed — no warning shownrtk init -gwithout jq installed — warning with install instructions showncargo test init::tests::test_check_jq_available_does_not_panicpassescargo clippy --all-targets— no new warnings🤖 Generated with Claude Code